/**
 *
 * 框架类
 * Created by wzj on 2017/4/10.
 */

function JBSFrame() {
	var self = this;

	//所有含有datetimepicker元素生成时间控件
	this.renderDatetimepicker =  function(){
		$(".datetimepicker").each(function(index,element){
			$(element).datetimepicker({
				locale: 'zh-cn',
				icons: {
					time: 'fa fa-clock-o',
					date: 'fa fa-calendar',
					up: 'fa fa-chevron-up',
					down: 'fa fa-chevron-down',
					previous: 'fa fa-chevron-left',
					next: 'fa fa-chevron-right',
					today: 'glyphicon glyphicon-screenshot',
					clear: 'fa fa-trash',
					close: 'fa fa-remove'
				},
			});
		});
	}

	//钱币控制
	// 保留小数点后两位，小数点前每三位数字之前增加逗号分隔
	this.renderMoneyMask = function(){
		$(".mask-money").each(function(index,element) {
			$(element).mask('000,000,000.00', {reverse: false});
		});
	}

	//系统确认框
	this.confirm = function(title,message,callback_confirm){
		$("#container-modal").remove();
		$("body").append('<div id="container-modal"></div>');

		ReactDOM.render(<Modal title={title} confirm="确定" cancel="取消" onConfirm={onConfirm}>{message}</Modal>,document.getElementById("container-modal"));

		//确定事件
		function onConfirm(){
			if(callback_confirm){
				callback_confirm();
			}
		}
	}

	//生成数据表
	this.renderRTable = function(elementId){
		ReactDOM.render(<RTable />,document.getElementById(elementId));
	}
}


